package com.demo.spring.rag;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.demo.domain.Msg;

import reactor.core.publisher.Flux;

@RestController
public class ChatController {

	@Autowired
	private ConsultantService consultantService;
	
	@PostMapping(value = "/chat", produces = "text/html;charset=utf-8")
	public Flux<String> chat(@RequestBody Msg msg) {
		Flux<String> result = consultantService.chat(msg.getMemoryId(), msg.getMessage());
		return result;
	}
	
}
